package clark.test

import clark.model.Tools

/**
 * @author Cui Gang
 * email:<a href="javascript:mailto">clarkhillm@gmail.com</a>
 *
 */

object Sql {
    val connection = Tools.connection

    def q(sql: String) {
        val st = connection.createStatement
        val rs = st.executeQuery(sql)
        println("id\ttitle\tcatalog\tdate\t")
        Tools.Rs(rs) {
            print(rs.getString("id") + "\t")
            print(rs.getString("title") + "\t")
            print(rs.getString("catalog") + "\t")
            print(rs.getString("date") + "\t")
            println("")
        }
    }

    def e(sql: String) {
        val st = connection.createStatement
        st.execute(sql)
    }
}